package com.jswlw.controller.api;

import com.jswlw.controller.api.resp.BillSetListResponse;
import com.jswlw.controller.api.resp.DevTypeResponse;
import com.jswlw.controller.api.resp.DistributorListResponse;
import com.jswlw.controller.api.wrapper.BillSetWrapper;
import com.jswlw.controller.api.wrapper.DevTypeWrapper;
import com.jswlw.controller.api.wrapper.DistributorWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 吴维斌 E-mail:wuweibin0817@163.com
 * @version 创建时间：${date} ${time}
 */
@Api(tags = "公共数据信息接口")
@RestController
@RequestMapping("/api/data")
public class ApiIndexController {

    @Autowired
    DistributorWrapper distributorWrapper;

    @Autowired
    BillSetWrapper billSetWrapper;

    @Autowired
    DevTypeWrapper devTypeWrapper;

    @ApiOperation(value = "经销商列表", notes = "经销商列表")
    @ApiResponse(code = 200, message = "OK", response = DistributorListResponse.class)
    @GetMapping("distributorList")
    public DistributorListResponse distributorList() {
        return distributorWrapper.distributorList();
    }

    @ApiOperation(value = "套餐列表", notes = "套餐列表")
    @ApiResponse(code = 200, message = "OK", response = BillSetListResponse.class)
    @GetMapping("billSetList/{devId}")
    public BillSetListResponse billSetList(@PathVariable("devId") String devId) {

        return billSetWrapper.billSetList(devId);
    }

    @ApiOperation(value = "设备型号列表", notes = "设备型号列表")
    @ApiResponse(code = 200, message = "OK", response = BillSetListResponse.class)
    @GetMapping("devTypeList/{distributorId}")
    public DevTypeResponse devTypeList(@PathVariable("distributorId") Integer distributorId) {
        return devTypeWrapper.devTypeList(distributorId);
    }
}
